package com.ac.scum.log.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@TableName("player_alarm_un_push")
public class PlayerAlarm {
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    private Long serverId;
    private Long playerId;
    private String detail;
    private Long logId;
    private LocalDateTime logTime;
    private String serverName;
    private String alarmDetail;
    private String alarmItem;
    private LocalDateTime createTime;

    public PlayerAlarmPushed PushedEntity() {
        PlayerAlarmPushed playerAlarmPushed = new PlayerAlarmPushed();
        playerAlarmPushed.setServerId(serverId);
        playerAlarmPushed.setPlayerId(playerId);
        playerAlarmPushed.setDetail(detail);
        playerAlarmPushed.setLogId(logId);
        playerAlarmPushed.setLogTime(logTime);
        playerAlarmPushed.setServerName(serverName);
        playerAlarmPushed.setAlarmDetail(alarmDetail);
        playerAlarmPushed.setAlarmItem(alarmItem);
        playerAlarmPushed.setPushTime(LocalDateTime.now());
        return playerAlarmPushed;
    }

    public PlayerAlarmError PushedErrorEntity(String error) {
        PlayerAlarmError playerAlarmError = new PlayerAlarmError();
        playerAlarmError.setServerId(serverId);
        playerAlarmError.setPlayerId(playerId);
        playerAlarmError.setDetail(detail);
        playerAlarmError.setLogId(logId);
        playerAlarmError.setLogTime(logTime);
        playerAlarmError.setServerName(serverName);
        playerAlarmError.setAlarmDetail(alarmDetail);
        playerAlarmError.setAlarmItem(alarmItem);
        playerAlarmError.setErrorMessage(error);
        playerAlarmError.setPushTime(LocalDateTime.now());
        return playerAlarmError;
    }
}
